package com.laopan.wxpay.request.query;

import com.laopan.wxpay.WxConstants;
import com.laopan.wxpay.bean.result.OrderResult;
import com.laopan.wxpay.exception.WxPayException;
import com.laopan.wxpay.request.RequestCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * 根据商户订单号查询微信订单
 *
 * @author laopan
 * @className MchOrderIdQuery
 * @date 2021/2/26 14:35
 */
public class MchOrderIdQuery implements
        QueryOrder<OrderResult> {

    private final static Logger log = LoggerFactory.getLogger(MchOrderIdQuery.class);

    private RealQueryOrder realQueryOrder;

    public MchOrderIdQuery(RealQueryOrder realQueryOrder) {
        this.realQueryOrder = realQueryOrder;
    }

    @Override
    public OrderResult query(String mchId, String id) throws WxPayException {
        return realQueryOrder.query(mchId, id, WxConstants.MCH_QUERY_PATH);
    }

    @Override
    public OrderResult query(String mchId, String id, RequestCallback<OrderResult> requestCallback) throws WxPayException {
        return realQueryOrder.query(mchId, id, WxConstants.MCH_QUERY_PATH, requestCallback);
    }
}
